This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.
source("tianfengRwrappers.R")
载入需要的程辑包:dplyr
载入程辑包:‘dplyr’
The following object is masked from ‘package:matrixStats’:
count
The following object is masked from ‘package:Biobase’:
combine
The following objects are masked from ‘package:GenomicRanges’:
intersect, setdiff, union
The following object is masked from ‘package:GenomeInfoDb’:
intersect
The following objects are masked from ‘package:IRanges’:
collapse, desc, intersect, setdiff, slice, union
The following objects are masked from ‘package:S4Vectors’:
first, intersect, rename, setdiff, setequal, union
The following objects are masked from ‘package:BiocGenerics’:
combine, intersect, setdiff, union
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
载入需要的程辑包:reticulate
载入需要的程辑包:tidyr
载入程辑包:‘tidyr’
The following object is masked from ‘package:S4Vectors’:
expand
载入程辑包:‘MySeuratWrappers’
The following objects are masked from ‘package:Seurat’:
DimPlot, DoHeatmap, LabelClusters, RidgePlot, VlnPlot
载入程辑包:‘cowplot’
The following object is masked from ‘package:ggpubr’:
get_legend
载入需要的程辑包:viridisLite
载入程辑包:‘reshape2’
The following object is masked from ‘package:tidyr’:
smiths
NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
Registered S3 method overwritten by 'enrichplot':
method from
fortify.enrichResult DOSE
clusterProfiler v3.14.3 For help: https://guangchuangyu.github.io/software/clusterProfiler
If you use clusterProfiler in published research, please cite:
Guangchuang Yu, Li-Gen Wang, Yanyan Han, Qing-Yu He. clusterProfiler: an R package for comparing biological themes among gene clusters. OMICS: A Journal of Integrative Biology. 2012, 16(5):284-287.
载入程辑包:‘clusterProfiler’
The following object is masked from ‘package:DelayedArray’:
simplify
Registering fonts with R
载入程辑包:‘plotly’
The following object is masked from ‘package:ggplot2’:
last_plot
The following object is masked from ‘package:IRanges’:
slice
The following object is masked from ‘package:S4Vectors’:
rename
The following object is masked from ‘package:stats’:
filter
The following object is masked from ‘package:graphics’:
layout
载入需要的程辑包:e1071
载入程辑包:‘widgetTools’
The following object is masked from ‘package:dplyr’:
funs
载入程辑包:‘DynDoc’
The following object is masked from ‘package:DelayedArray’:
path
The following object is masked from ‘package:BiocGenerics’:
path
载入程辑包:‘DT’
The following object is masked from ‘package:Seurat’:
JS
========================================
circlize version 0.4.13
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/
If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
in R. Bioinformatics 2014.
This message can be suppressed by:
suppressPackageStartupMessages(library(circlize))
========================================
载入需要的程辑包:grid
========================================
ComplexHeatmap version 2.2.0
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
genomic data. Bioinformatics 2016.
========================================
载入程辑包:‘ComplexHeatmap’
The following object is masked from ‘package:plotly’:
add_heatmap
#提取SMC细胞亚群
SMCs_list <- list(ds0,ds2)
SMCs_list <- lapply(X = SMCs_list, FUN = function(x) {
x <- NormalizeData(x)
x <- FindVariableFeatures(x, selSMCtion.method = "vst", nfeatures = 2000)
})
#需要分析的差异基因
int_features <- SelectIntegrationFeatures(object.list = SMCs_list)
#选择合并的anchor特征
int_anchors <- FindIntegrationAnchors(object.list = SMCs_list, anchor.features = int_features)
#根据anchor合并
SMCs_combined <- IntegrateData(anchorset = int_anchors)
DefaultAssay(SMCs_combined) <- "integrated"
rm("SMCs_list","int_features","int_anchors")
SMCs_combined <- ScaleData(SMCs_combined, verbose = FALSE)
SMCs_combined <- RunPCA(SMCs_combined, npcs = 30, verbose = FALSE)
SMCs_combined <- RunUMAP(SMCs_combined, reduction = "pca", dims = 1:30)
SMCs_combined <- FindNeighbors(SMCs_combined, reduction = "pca", dims = 1:30)
SMCs_combined <- FindClusters(SMCs_combined, resolution = 0.1) # resolution 取0.1 或 0.2
umapplot(SMCs_combined)
SMCs_combined <- FindClusters(SMCs_combined, resolution = 0.2) # resolution 取0.1 或 0.2
umapplot(SMCs_combined)
umapplot(SMCs_combined, split.by = "conditions")
# Idents(SMCs_combined) <- SMCs_combined$orig.ident
# # SMCs_combined <- RenameIdents(SMCs_combined,
# '1'='coronary arteries','2'='coronary arteries',
# '3'='coronary arteries','4'='coronary arteries',
# '5'='coronary arteries','6'='coronary arteries',
# '7'='coronary arteries','8'='coronary arteries',
# 'CA_sample1.txt'='carotid arteries',
# 'CA_sample2.txt'='carotid arteries','CA_sample3.txt'='carotid arteries',)
# SMCs_combined$conditions <- Idents(SMCs_combined)
# Idents(SMCs_combined) <- SMCs_combined$conditions
# ds0_SMC <- merge(subset(SMCs_combined,ident = "NA"),subset(SMCs_combined,ident = "AC"))
# ds0_SMC@reductions[["umap"]] <- SMCs_combined@reductions[["umap"]]
multi_featureplot(c("DCN","LUM","MMP2","ACTA2"),SMCs_combined,labels = "",label = F,min.cutoff = 0)
datamat[datamat>0] <- 0
datamat[datamat<0] <- 1
pheatmap::pheatmap(datamat, color = c("#FFFFFF", "#000000"),
border_color = NA, cluster_rows = T, cluster_cols = FALSE,
main = "CCA data", show_rownames = F,show_colnames = F)
CAD_merge_CCA <- FindClusters(CAD_merge_CCA, resolution = 0.2) # resolution 取0.1 或 0.2
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 19199
Number of edges: 750750
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9332
Number of communities: 10
Elapsed time: 3 seconds
umapplot(CAD_merge_CCA)
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing
scale.
Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.